import os
import filecmp


def jude_Text(srcflie, dicfile):
    "单个文件比对"
    diff = filecmp.cmp(srcflie, dicfile)
    if diff:
        print("文件一致")
    else:
        print("文件不一致")


path = os.path.abspath(os.path.dirname(__file__))


# jude_Text(srcflie=path + "/../diff/3.txt",
#           dicfile=path + "/../diff/4.txt")

def diff_Dirobj(srcdir, dicdir):
    # srcdir =path+"\\dir1"
    # dicdir =path+"\\dir2"
    # 目录比较，忽略2.txt.txt这个文件
    # dirobj =filecmp.dircmp(srcdir,dicdir,["2.txt.txt"])
    dirobj = filecmp.dircmp(srcdir, dicdir)
    dirobj.report()
    dirobj.report_partial_closure()
    dirobj.report_full_closure()


diff_Dirobj(srcdir=path + "\\dir1", dicdir=path + "\\dir2")
# 深度遍历 Differing files : ['2.txt.txt', 'diffFile.py']
